﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using CMSWCSFSolution.CMS.Interface.Services;
using CMS.Model;

namespace CMSWCSFSolution.CMS.Views
{
    public class CreateTeacherPresenter : Presenter<ICreateTeacherView>
    {
        private ICMSService _service;
        public CreateTeacherPresenter([CreateNew] ICMSService service)
        {
            _service = service;
        }
        public void OnSelectedAllDepartments()
        {
             View.BindDepartment= _service.GetAllDepartments();
        }
        public void OnAddTeacher()
        {
            Teacher teacher = new Teacher(0, null, null, 0, null);
            teacher = View.teacherInsert;
            teacher.Department = View.department;
            _service.AddTeacher(teacher);
        }
        public Department OnSelectedDepartmentById()
        {
            Department dep = new Department();
            return ( _service.GetDepartmentById(View.teacherInsert.DepartmentId))[0];  
        }
        public override void OnViewLoaded()
        {
        }

        public override void OnViewInitialized()
        {
        }
    }
}




